﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using StructureMap;
using BonsaiScrum.Bus;
using BonsaiScrum.Core.BusImpl;
using BonsaiScrum.Core.Infrastructure;
using BonsaiScrum.Core.Persistance;
using BonsaiScrum.Data;
using BonsaiScrum.Mvc.Services;

namespace BonsaiScrum.Mvc
{
    public class InjectionContainer
    {
        public static void Configure()
        {
            ObjectFactory.Initialize(x =>
            {
                x.For<ICommandBus>()
                    .HybridHttpOrThreadLocalScoped()
                    .Use<InProcessCommandBus>();

                x.For<IRouteMessages>()
                    .Singleton()
                    .Use<MessageRouter>();

                x.For<ILogger>()
                    .Use<NLogLogger>();

                x.For<IMembershipService>()
                    .Use<AccountMembershipService>();

                x.For<IFormsAuthenticationService>()
                    .Use<FormsAuthenticationService>();

                x.For<IUserSession>()
                    .Use<HttpUserSession>();

                x.IncludeRegistry<NHibernateRegistry>();
            });
        }
    }
}
